package com.lmm.lcuser.lc_user.plugins;

import android.content.Intent;
import android.os.Bundle;
import com.facebook.react.bridge.Callback;
import com.lmm.dresswisdom.lmmframe.reactnative.BasePlugin;
import com.lmm.dresswisdom.lmmframe.reactnative.annotation.RNPlugin;
import com.lmm.lcuser.lc_user.MainActivity;
import com.lmm.lcuser.lc_user.pages.ShopMapActivity;

import java.util.Map;

/**
 * Created by xmgong on 2017/11/28.
 */
@RNPlugin(method = "navi")
public class NaviPlugin extends BasePlugin<MainActivity> {
    public NaviPlugin(MainActivity act) {
        super(act);
    }

    @Override
    protected void doAction(Map<String, Object> map, Callback callback) {
//        是否需要登录验证
//        boolean isNeedLogin = (boolean) map.get("isneedLogin");
//        路由地址
        String route = (String) map.get("router");
//        参数
//        Map<String, Object> params = (Map<String, Object>) map.get("params");
//        Bundle mbundle = new Bundle();
//        Object value = null;
//        for (String in : params.keySet()) {
//            value = params.get(in);
//            if (value instanceof Integer) {
//                mbundle.putInt(in, Integer.parseInt(String.valueOf(value)));
//            }
//            if (value instanceof Double) {
//                mbundle.putDouble(in, Double.parseDouble(String.valueOf(value)));
//            }
//            if (value instanceof String) {
//                mbundle.putString(in, String.valueOf(value));
//            }
//            if (value instanceof Boolean) {
//                mbundle.putBoolean(in, Boolean.valueOf(String.valueOf(value)));
//            }
//        }


        if (route.equals("shopmap")){
            activity.startActivity(new Intent(activity , ShopMapActivity.class));
        }

    }
}
